/**
 * 新建随访组的验证
 */
$(function () {
    var index1 = false;
    /**
     * 验证手机号是否正确
     */
    $("#telephone").blur(function () {
        var tele = $("#telephone").val();
        var patrn = /^(13[0-9]|15[0-9]|18[0-9])\d{8}$/;
        if (patrn.test(tele) == false) {
            $("#telephones").html("请填写正确的手机号").css('color', 'red');
            index1 = false;
        } else {
            $("#telephones").html("").css('color', 'green');
            index1 = true;
        }
    })

    var index2 = false;
    /**
     * 验证负责人是否为空
     */
    $("#principal").blur(function () {
        var name = $("#principal").val();
        if (name.trim() == null || name.trim() == "") {
            $("#principals").html("请填写负责人").css('color', 'red');
            index2 = false;
        } else {
            $("#principals").html("").css('color', 'green');
            index2 = true;
        }
    })



    var index4 = false;
    /**
     * 验证创建人是否为空
     */
    $("#creator").blur(function () {
        var creators = $("#creator").val();
        if (creators.trim() == null || creators.trim() == "") {
            $("#screator").html("请填写创建人").css('color', 'red');
            index4 = false;
        } else {
            $("#screator").html("").css('color', 'green');
            index4 = true;
        }
    })

    var index5 = false;
    /**
     * 验证课题编号是否为空
     */
    $("#projectNumber").blur(function () {
        var sprojectNumber = $("#projectNumber").val();
        if (sprojectNumber.trim() == null || sprojectNumber.trim() == "") {
            $("#projectNumbers").html("请填写课题编号").css('color', 'red');
            index5 = false;
        } else {
            $("#projectNumbers").html("").css('color', 'green');
            index5 = true;
        }
    })
})